#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<assert.h>
#include<unistd.h>
#include<string.h>
#define FILE_NAME(number) "log.txt"#number

int main()
{
    umask(0);
    int fd1 = open(FILE_NAME(1),O_WRONLY | O_CREAT | O_TRUNC, 0666);
    int fd2 = open(FILE_NAME(2),O_WRONLY | O_CREAT | O_TRUNC, 0666);
    int fd3 = open(FILE_NAME(3),O_WRONLY | O_CREAT | O_TRUNC, 0666);
    int fd4 = open(FILE_NAME(4),O_WRONLY | O_CREAT | O_TRUNC, 0666);
    int fd5 = open(FILE_NAME(5),O_WRONLY | O_CREAT | O_TRUNC, 0666);

    assert(fd1 > 0);
    assert(fd2 > 0);
    assert(fd3 > 0);
    assert(fd4 > 0);
    assert(fd5 > 0);

    printf("stdin->fd:%d\n",stdin->_fileno);
    printf("stdout->fd:%d\n",stdout->_fileno);
    printf("stderr->fd:%d\n",stderr->_fileno);
    printf("fd1 = %d\n",fd1);
    printf("fd2 = %d\n",fd2);
    printf("fd3 = %d\n",fd3);
    printf("fd4 = %d\n",fd4);
    printf("fd5 = %d\n",fd5);

    close(fd1);
    close(fd2);
    close(fd3);
    close(fd4);
    close(fd5);

    return 0;
}
